package com.axonactive.training.dao;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.axonactive.training.model.Book;

@Stateless
public class BookDao {
	@PersistenceContext
	private EntityManager em;
	
	public List<Book> getBookList(){
		return em.createQuery("select b from Book b", Book.class).getResultList();
	}
	
	public void saveBook(Book book){
		em.persist(book);
	}
}
